<template>
	<view class="content">
		<u-swiper :list="list3" indicator :radius="0" indicatorMode="line" circular></u-swiper>
		<view style="height: 20rpx;"></view>
		<view class="options" @tap="toOutstash">
			<image src="../../static/chuku.png"></image>
			<text>防伪认证</text>
		</view>
		<view class="user-card">
			<view class="user-card-avatar">
				<image :src="avatar?avatar:require('@/static/tx1.jpg')" mode=""></image>
			</view>
			<view class="user-card-name">
				<view class="user-card-name-nick">{{nickname}}</view>
				<!-- <view class="user-card-name-mobile">{{user.mobile}}</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list3: [require('@/static/banner1.jpg')],
				user: {},
				avatar: '',
				nickname: ''
			}
		},
		onShow() {
			uni.setStorageSync('scangoodid', '')
			uni.setStorageSync('mode', '')
			this.init()
		},
		methods: {
			async init() {
				await this.request('index/index', {}, 'POST').then(res => {

				})
				await this.request('user/index', {}, 'POST').then(res => {
					if (res.code === 1) {
						this.nickname = res.data.user.nickname
						this.avatar = res.data.user.avatar
					}
				})
			},
			toOutstash() {
				const tk = uni.getStorageSync('usertoken')
				if (tk) {
					uni.navigateTo({
						url: '/pages/outstash/outstash'
					})
				} else {
					uni.showToast({
						icon: 'none',
						title: '请先登录'
					})
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/accountLogin/accountLogin'
						})
					}, 1500)
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {}

	.options {
		width: 700rpx;
		height: 160rpx;
		margin: 0 auto 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #2e8bf0;
		border-radius: 10rpx;
	}

	.options image {
		width: 80rpx;
		height: 80rpx;
		margin-right: 20rpx;
		background: #fff;
		box-sizing: border-box;
	}

	.options text {
		color: #fff;
	}

	.user-card {
		width: 700rpx;
		height: 160rpx;
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 0 20rpx;
		margin: 0 auto;
		background: #fcfcfc;
	}

	.user-card-avatar {
		margin-right: 20rpx;
	}

	.user-card-avatar image {
		width: 120rpx;
		height: 120rpx;
		border-radius: 60rpx;
	}

	.user-card-name-nick {
		font-size: 40rpx;
	}

	.user-card-name-mobile {
		font-size: 28rpx;
		color: #339af0;
	}
</style>